{include file="public/header" /}
</head>
<body>
<form class="layui-form layui-form-pane" action="" style="width: 80%;margin: 20px auto;">
    <input type="hidden" name="menu_id" value="{$dataInfo.menu_id|default=0}">
    <div class="layui-form-item">
        <label class="layui-form-label">菜单名称</label>
        <div class="layui-input-block">
            <input type="text" name="menu_name"  required lay-verify="required"  placeholder="请输入菜单名称" autocomplete="off" class="layui-input" value="{$dataInfo.menu_name|default=''}">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">上级菜单</label>
        <div class="layui-input-block">
            <select name="parent_id" lay-search>
                <option value="0">顶级分类</option>
                {notempty name="menuAllList"}
                {volist name="menuAllList" id="tl"}
                <option value="{$tl.menu_id}" {present name="dataInfo.parent_id"}{if condition="$tl['menu_id'] == $dataInfo['parent_id']"}selected{/if}{/present}>{notempty name="$tl.level_name"}{$tl.level_name}&ensp;{/notempty}{$tl.menu_name}</option>
                {/volist}
                {/notempty}
            </select>
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">URL地址</label>
        <div class="layui-input-block">
            <input type="text" name="menu_url"  placeholder="请输入URL地址，例：Admin/Index/index" autocomplete="off" class="layui-input" value="{$dataInfo.menu_url|default=''}">
        </div>
    </div>
    <div class="layui-form-item" pane>
        <label class="layui-form-label">菜单显示</label>
        <div class="layui-input-block">
            {notempty name="IsNoRadio"}
            {volist name="IsNoRadio" id="tl"}
            <input type="radio" name="is_left" value="{$key}" title="{$tl}" {present name="dataInfo.is_left"}{if condition="$dataInfo['is_left'] == $key"}checked{/if}{else/}{eq name="key" value="0"}checked{/eq}{/present}>
            {/volist}
            {/notempty}
        </div>
    </div>
    <div class="layui-form-item" pane>
        <label class="layui-form-label">验证权限</label>
        <div class="layui-input-block">
            {notempty name="AuthorityRadio"}
            {volist name="AuthorityRadio" id="tl"}
            <input type="radio" name="is_authority" value="{$key}" title="{$tl}" {present name="dataInfo.is_authority"}{if condition="$dataInfo['is_authority'] == $key"}checked{/if}{else/}{eq name="key" value="1"}checked{/eq}{/present}>
            {/volist}
            {/notempty}
        </div>
    </div>
    <div class="layui-form-item" pane>
        <label class="layui-form-label">链接形式</label>
        <div class="layui-input-block">
            {notempty name="MenuTypeRadio"}
            {volist name="MenuTypeRadio" id="tl"}
            <input type="radio" name="type" value="{$key}" title="{$tl}" {present name="dataInfo.type"}{if condition="$dataInfo['type'] == $tl"}checked{/if}{else/}{eq name="key" value="0"}checked{/eq}{/present}>
            {/volist}
            {/notempty}
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">排序</label>
        <div class="layui-input-block">
            <input type="text" name="sort" required  lay-verify="required" placeholder="请输入排序" autocomplete="off" class="layui-input" value="{$dataInfo.sort|default='1'}">
        </div>
    </div>
    <div class="layui-form-item">
        <div class="layui-input-block">
            <button class="layui-btn" type="button" lay-submit lay-filter="formDemo">立即提交</button>
        </div>
    </div>
</form>
</body>
<script>
    layui.use('form', function(){
        var form = layui.form;
        form.render();
        //监听提交
        form.on('submit(formDemo)', function(data){
            post_sub("{:url('Menus/add')}",data.field);
            return false;
        });
    });
</script>
</html>